# encoding: utf-8
# Datetime  : 2020/6/1 8:22 PM
# User      : zzz
# File      : test.py


import requests
import json

from lxml import etree

import discuss_spider
from util import proxy_util

HEADERS = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'none',
    'Sec-Fetch-User': '?1',
    'Upgrade-Insecure-Requests': '1',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
}


# url = 'https://www.discuss.com.hk/forumdisplay.php?fid=415&filter=0&orderby=dateline&ascdesc=DESC&page=1'
url = 'http://www.cip.cc/'
response = discuss_spider.get_response(url)
# response = requests.get(url, headers=HEADERS, proxies=proxy_util.get_proxy(), timeout=60)
html_res = etree.HTML(response.text)
ip_info = html_res.xpath('//div[@class="data kq-well"]/pre')
if ip_info:
    print(ip_info[0].text)
